package com.yunji.cabinet.context.convert;

import com.yunji.cabinet.cache.CabinetCache;
import com.yunji.cabinet.domain.UpgradeInfoDO;
import com.yunji.cabinet.vo.UpgradeInfoVO;
import com.yunji.common.utils.bean.BeanUtils;

import java.util.ArrayList;
import java.util.List;

public class UpgradeInfoConvert {
    public static List<UpgradeInfoVO> domainTOVOList(List<UpgradeInfoDO> list){
        List<UpgradeInfoVO> voList = new ArrayList<>();
        list.forEach(item->{
            UpgradeInfoVO vo = domainTOVO(item);
            vo.setTypeName(CabinetCache.getTypeCode(vo.getChipImei()));
            voList.add(vo);
        });
        return voList;
    }

    public static UpgradeInfoVO domainTOVO(UpgradeInfoDO domain){
        UpgradeInfoVO vo = new UpgradeInfoVO();
        BeanUtils.clone(domain,vo);
        return vo;
    }
}
